import { Column, Entity, Index } from "typeorm";
import { DeletedEntity } from "./base/deleted.entity";

@Index("sys_dept_code_not_deleted_ukey", ["code"], { unique: true })
@Index("sys_dept_pkey", ["id"], { unique: true })
@Entity("sys_dept", { schema: "public" })
export class SysDept extends DeletedEntity {
    @Column("bigint", { primary: true, name: "id" })
    id!: string;

    @Column("bigint", { name: "parent_id", nullable: true })
    parentId!: string | null;

    @Column("character varying", { name: "name", length: 32 })
    name!: string;

    @Column("character varying", { name: "full_name", length: 512 })
    fullName!: string;

    @Column("character varying", { name: "phone", nullable: true, length: 16 })
    phone!: string | null;

    @Column("character varying", { name: "email", nullable: true, length: 64 })
    email!: string | null;

    @Column("bigint", { name: "type" })
    type!: string;

    @Column("integer", { name: "level" })
    level!: number;

    @Column("character varying", { name: "code", length: 128 })
    code!: string;

    @Column("character varying", { name: "remark", nullable: true, length: 256 })
    remark!: string | null;
}
